//处理发送请求
import axios from "axios";
//将axios实例的基本配置从config文件中引入 获取基本配置作为axios实例的配置
import config from "./config";
import Nprogress from "nprogress/nprogress.js"
const {baseURL="",timeout=10000} = config
//创建axios实例
const product = axios.create({
    baseURL,
    timeout
})
product.interceptors.request.use(function (config) {
    Nprogress.start();
    return config;
});
product.interceptors.response.use(function (response) {
    Nprogress.done();
    return response.data;
}, function (error) {
    Nprogress.done();
    return Promise.reject(error);
});
export default product;